<%@page import="com.bms.entity.Book"%>
<%@page import="java.util.List"%>
<%@page import="com.bms.dao.BookDao"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>图书管理信息系统-图书管理</title>
<link rel=stylesheet href="../inc/main.css" type="text/css">
<style type="text/css">
</style>
</head>
<body>
	<%@include file="/inc/head.jsp"%>
	<table align="center" width="980">
		<caption>图书列表</caption>
		<tr>
			<td colspan="8">
				<a href="#" onclick="window.open('<%=request.getContextPath() %>/books/add.jsp', '', 'width=750,height=400')">+添加新图书</a>
			</td>
		</tr>
		<tr>
			<th width="50">序号</th>
			<th width="130">图书ISBN</th>
			<th width="300">书名</th>
			<th width="150">出版社名称</th>
			<th width="70">价格</th>
			<th width="70">版本号</th>
			<th width="80">出版年份</th>
			<th width="130">操作</th>
		</tr>
		<%
			BookDao bookDao=new BookDao();
			List<Book> books=bookDao.queryAll();
			if(books!=null&&books.size()>0){
				for(int i=0;i<books.size();i++){
					Book book=books.get(i);
		%>
		<tr>
			<td><%=(i+1) %></td>
			<td><%=book.getIsbn()%></td>
			<td><%=book.getName() %></td>
			<td><%=book.getPublisherName() %></td>
			<td><%=book.getPrice() %></td>
			<td><%=book.getVersion() %></td>
			<td><%=book.getPublishTime() %></td>
			<td align="center">
				<a href="<%=request.getContextPath()%>/bookAction?isbn=<%=book.getIsbn()%>&method=delete">删除</a>
				<a href="#" onclick="window.open('<%=request.getContextPath() %>/books/edit.jsp?isbn=<%=book.getIsbn()%>', '', 'width=750,height=400')">修改</a>
			</td>
		</tr>
		<%
				}
			}else{
		%>
		<tr>
			<td align="center" colspan="8">
				没有任何的图书信息！
			</td>
		</tr>
		<%
			}
		%>
	</table>
</html>